Ext.define('qjtravel.view.TravelDetail', {
    extend: 'Ext.Panel',
    xtype: 'travelDetail',

    config: {
        layout: 'vbox',
        items: [
            {
                xtype:'toolbar',
                id: 'toolbar_travel',
                docked: 'top',
                items:[
                {
                    xtype: 'button',
                    text: '返回',
                    listeners: {
                        tap: function () {
                            var backid = Ext.Viewport.getInnerItems().length
                            Ext.getCmp("toolbar_travel").setTitle("");
                            var contentH=Ext.getCmp("contentView").getHeight();
                            Ext.getCmp("contentView").setHtml("")
                            Ext.getCmp("contentView").setHeight(contentH+"px")
                            Ext.Viewport.remove(this.up('travelDetail'), true);
                            Ext.Viewport.setActiveItem(backid - 2);
                        }
                    }
                }
            ]
            },{
                xtype: 'hiddenfield',
                name: 'cpid',
                id:"fieldCpid"
            },
            {
                xtype: 'dataview',
                style:'margin:10px',
                cls:"detailTextClass",
                store: 'ProductDetail',
                flex:3,
                emptyText: '未添加攻略',
                id:"contentView",
                listeners:{
                    painted:function(){
                        Ext.getStore('ProductDetail').load({params:{cpid:Ext.getCmp("fieldCpid").getValue()}});
                    }
                }

            },{
                xtype: 'textfield',
                id: 'toolbar_name',
                hidden: true
            }
        ],listeners: {
            back:function() {
                Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
            },
            initialize:function(){
                Ext.getCmp("toolbar_travel").setTitle("");
                var contentH=Ext.getCmp("contentView").getHeight();
                Ext.getCmp("contentView").setHtml("")
                Ext.getCmp("contentView").setItemTpl("<div class='content'>{explain}</div>")
            }
        }
    }
});
